﻿@model ipFoo.Models.AdvancedFeatureModel

@* This is only used when javascript is disabled and a postback happens through the browser *@
@if (ViewBag.ResponseBlock != null)
{
    <div>
        <h3>Your results, sir.</h3>
        <div class="smallheader">(Other titles: Madame, my lord, king of the lab, alien overlord)</div>

        <pre>@ViewBag.ResponseBlock</pre>
    </div>

    <hr />
}

<h3>
Advanced Features
</h3>
<div class="smallheader">Warning: Contains small parts.</div>

@if (ViewBag.ValidExecution == null)
{
    <div class="alert-message block-message">
        <p>
            Advanced features are fun, right? Well, to be honest, these are pretty cut and dry. All these allow you to do is perform simple data lookups that you could do pretty much anywhere else. I'm simply saving you the clicks. Isn't that nice of me? I thought so.
        </p>
        <p>&nbsp;</p>
        <p>
            Anyways, to use these features, all you have to do is enter a a value (ip address or host name, depending on the lookup), select what function to run, enter the special captcha text, and submit your request! The information will be sent to the server and your requested information will be sent right back here for you to see.
        </p>
    </div>
}

@using (Html.BeginForm())
{
    <fieldset>
        <div id="LookupDiv" class="clearfix">
            <label>Enter IP or Host</label>
            <div class="input">
                @Html.TextBox("Lookup", Model.Lookup)
            </div>
        </div>

        <div id="ActionDiv" class="clearfix">
            <label>Select Function</label>
            <div class="input">
                <ul class="inputs-list">
                    <li>
                        <label>
                            @Html.RadioButtonFor(m => m.Action, "whois")<span>Whois</span>
                        </label>
                    </li>
                    <li>
                        <label>
                            @Html.RadioButtonFor(m => m.Action, "iptohost")<span>IP -> Host</span>
                        </label>
                    </li>
                    <li>
                        <label>
                            @Html.RadioButtonFor(m => m.Action, "hosttoip")<span>Host -> IP</span>
                        </label>
                    </li>
                </ul>
            </div>
        </div>
        <div id="ValidateDiv" class="clearfix">
            <label>Validate Humanity</label>
            <div class="input">
                @{Html.RenderPartial("recaptcha");}
            </div>
        </div>

        @if (ViewBag.ValidExecution != null && !(bool)ViewBag.ValidExecution)
        {
            <div class="alert-message error">
                <p>
                    It appears you missed some important information. Please check the form and try again.
                </p>
            </div>
        }

        <div id="errorsFoundMessage" class="alert-message error">
            <p>
                It appears you missed some important information. Please check the items highlighted in red and try again.
            </p>
        </div>
        <div class="actions">
            <div id="loading">
                <img id="loadingImage" src="@Url.Content("~/Content/Images/refresh.gif")" alt="Data is loading, please wait." />
            </div>

            <button id="submitCommand" type="submit" class="btn primary">Execute Command</button><br/>
        </div>
    </fieldset>
}

<div id="postbackResultsBox">
    <h3>Your results, sir.</h3>
    <div class="smallheader">(Other titles: Madame, my lord, king of the lab, alien overlord)</div>

    <pre id="postbackResults"></pre>
</div>